package com.ives.launcher.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;

import com.ives.launcher.R;
import com.ives.launcher.util.SelectorUtil;

/**
 * 菜单页面底部菜单
 * 
 * @author ives
 * 
 */
public class View_Apps_BottomMenu extends RelativeLayout {
	//三个按钮
			MyButton leftBtn,centerBtn,rightBtn;
			View line;
			public View_Apps_BottomMenu(Context context, AttributeSet attrs,int defStyle) {
				super(context, attrs, defStyle);
				init();
			}

			public View_Apps_BottomMenu(Context context, AttributeSet attrs) {
				this(context, attrs, 0);
			}

			public View_Apps_BottomMenu(Context context) {
				this(context, null);
			}
			private void init(){
				line = new View(getContext());
				leftBtn = new MyButton(getContext());
				centerBtn = new MyButton(getContext());
				rightBtn = new MyButton(getContext());
				RelativeLayout.LayoutParams params_line = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
				RelativeLayout.LayoutParams params_left = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
				RelativeLayout.LayoutParams params_center = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
				RelativeLayout.LayoutParams params_right = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
				params_line.addRule(RelativeLayout.ALIGN_PARENT_TOP);
				
				params_left.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
				params_left.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
				
				params_center.addRule(RelativeLayout.CENTER_IN_PARENT);
				params_center.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
				
				params_right.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
				params_right.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
				
				line.setBackgroundResource(R.drawable.line_dark);
				centerBtn.setImageDrawable(SelectorUtil.newSelector(getContext(), R.drawable.allapps_mainbtn_dark, R.drawable.allapps_mainbtn_light, R.drawable.allapps_mainbtn_light, R.drawable.allapps_mainbtn_dark));
				leftBtn.setImageDrawable(SelectorUtil.newSelector(getContext(), R.drawable.allapps_menu_btn_dark, R.drawable.allapps_menu_btn_light, R.drawable.allapps_menu_btn_light, R.drawable.allapps_menu_btn_dark));
				rightBtn.setImageDrawable(SelectorUtil.newSelector(getContext(), R.drawable.allapps_more_btn_dark, R.drawable.allapps_more_btn_light, R.drawable.allapps_more_btn_light, R.drawable.allapps_more_btn_dark));

				this.addView(line,params_line);
				this.addView(leftBtn,params_left);
				this.addView(centerBtn,params_center);
				this.addView(rightBtn,params_right);
				
			}

			public MyButton getLeftBtn() {
				return leftBtn;
			}

			public void setLeftBtn(MyButton leftBtn) {
				this.leftBtn = leftBtn;
			}

			public MyButton getCenterBtn() {
				return centerBtn;
			}

			public void setCenterBtn(MyButton centerBtn) {
				this.centerBtn = centerBtn;
			}

			public MyButton getRightBtn() {
				return rightBtn;
			}

			public void setRightBtn(MyButton rightBtn) {
				this.rightBtn = rightBtn;
			}


		}
